package com.jyh.fanxing;

import java.util.Arrays;

/**
 * @Author JYH
 * @Date 2024/7/31 19:43
 * @Description
 */
public class maoPao {
    public static void main(String[] args) {
        Integer[]arr={1,2,3,4};
        sort(arr);
        System.out.println(Arrays.toString(arr));
    }

    public static <T> void sort(T[] arr){
        if (arr == null || arr.length <= 1) {
            return;
        }
        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length - 1 - i; j++) {
                if (j>j+1){
                    T temp=arr[j];
                    arr[j]=arr[j+1];
                    arr[j+1]=temp;
                }
            }

        }

    }
}
